function errors = calculateError( calculated_targets, expected_targets )
%CALCULATEERROR
    
    class  = unique(expected_targets);
    nClasses = length(class);
    errors = zeros(1, nClasses + 1);
    N = length(expected_targets);
     qtdClasse = zeros(1, nClasses);
    

    for i = 1 : N
        if (calculated_targets(i) ~= expected_targets(i))
            errorClass = expected_targets(i)+1;
            errors(errorClass) = errors(errorClass) + 1;
        end
    end
    
    for i = 1 : nClasses
        qtdClasse(i) =  length(find(expected_targets(1:N) == class(i)));
        errors(i) = errors(i)/qtdClasse(i);        
    end
    
    errors(nClasses + 1) = (sum(errors)/nClasses);

end

